// 发送请求
import Ajax from '../utils/ajax'
import mockAjax from '@/utils/mockAjax'

/*****************************************/ 
// 搜索页请求

export const reqGoodsListInfo = (searchParams) =>{
    return Ajax({
        url:'/list',
        method:'post',
        data:searchParams
    })
}

// 注册
export const reqUserRegister = (userInfo) => {
    return Ajax({
      url:'/user/passport/register',
      method:'post',
      data:userInfo
    })
  }
// 登录
export const reqUserLogin = (userInfo) => {
    return Ajax({
      url:'/user/passport/login',
      method:'post',
      data:userInfo
    })
  }
// token
export const reqGetUserInfo = () => {
    return Ajax({
      url:'/user/passport/auth/getUserInfo',
      method:'get'
    })
  }
//获取购物车信息

export const  getshopCartList= ()=>{
  return Ajax({
      url:'/cart/cartList',
      method:'get',
  })
}

export const reqCatgrotList =()=>{
    return Ajax({
        url:'/product/getBaseCategoryList',
        method:'GET'
    })
}
/*****************************************/ 
/**
 * 获取商品详情信息
 * @param {*} skuId 
 * @returns 
 */
export const reqItemInfoBySkuId = (skuId) => {
    return Ajax({
        method: "get",
        url: `/item/${skuId}`
    })
}
/************************************** */
/**
 * 添加至购物车
 * @param {*} skuId 
 * @param {*} skuNum 
 * @returns 
 */
 export const reqAddOrUpdateCart = (skuId, skuNum) => {
    return Ajax({
      url: `/cart/addToCart/${skuId}/${skuNum}`,
      method: 'post'
    })
  }